package com.blog.admin.controller;


import com.alibaba.fastjson.JSONObject;
import com.blog.admin.service.LoginService;
import com.blog.admin.vo.WebResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("login")
    public WebResult<JSONObject> login(@RequestBody JSONObject loginParam) {
        return loginService.login(loginParam);
    }

    @GetMapping("logout")
    public WebResult<String> logout(@RequestHeader("Authorization") String token) {
        return loginService.logout(token);
    }

}
